package com.ruoyi.project.relation.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.project.relation.domain.OneWayBusinessRelationship;
import com.ruoyi.project.relation.domain.qo.OneWayBusinessRelationshipQO;
import com.ruoyi.project.relation.service.IOneWayBusinessRelationshipService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 单向业务关联Controller
 *
 * @author wb
 * @date 2021-04-25
 */
@RestController
@RequestMapping("/relation/OneWayBusinessRelationship")
public class OneWayBusinessRelationshipController extends BaseController
{
    @Autowired
    private IOneWayBusinessRelationshipService oneWayBusinessRelationshipService;


    /**
     * 新增单向业务关联
     */
    //@PreAuthorize("@ss.hasPermi('relation:OneWayBusinessRelationship:add')")
    @RepeatSubmit
    @Log(title = "单向业务关联", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OneWayBusinessRelationship oneWayBusinessRelationship)
    {
        return AjaxResult.successData(oneWayBusinessRelationshipService.insertOneWayBusinessRelationship(oneWayBusinessRelationship));
    }

    /**
     * 删除单向业务关联
     */
    //@PreAuthorize("@ss.hasPermi('relation:OneWayBusinessRelationship:remove')")
    @Log(title = "单向业务关联", businessType = BusinessType.DELETE)
    @DeleteMapping("/{oneWayBusinessRelationshipIds}")
    public AjaxResult remove(@PathVariable Long[] oneWayBusinessRelationshipIds)
    {
        return toAjax(oneWayBusinessRelationshipService.deleteOneWayBusinessRelationshipByIds(oneWayBusinessRelationshipIds));
    }


}
